Created
August 31, 2022 23:39
-
-
Save magasine/6cf6d6c4e75b82a9d823ab81d4547efc to your computer and use it in GitHub Desktop.
! QRcode Select or Input - Bookmarklet
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
javascript: (function (window, document, undefined) { | |
try { | |
var selectedText = document.getSelection().toString(); | |
if (selectedText === "") { | |
selectedText = window.location.href; | |
} | |
if (selectedText !== "") { | |
var clipB = prompt("Content to qrCode renderize", selectedText); | |
if (clipB !== null) { | |
void navigator.clipboard.writeText(clipB); | |
var baseQRUrl = | |
"http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=" + | |
encodeURIComponent(clipB); | |
window.open(baseQRUrl, "_blank", "width=400,height=400"); | |
} | |
} | |
} catch (e) {} | |
})(window, document); | |
// ! QRcode Select or Input - Bookmarklet | |
// Adapted from https://gist.github.com/lemieuxster/2579060 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment