Last active
November 28, 2019 01:06
-
-
Save ThomasR/19bb6807ff87097d2073 to your computer and use it in GitHub Desktop.
A bookmarklet that generates a QR Code of the current URL. Click to return to page content.
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: void (function (main) { | |
var script = document.createElement('script'); | |
script.onload = main; | |
script.src = 'https://davidshimjs.github.io/qrcodejs/qrcode.min.js'; | |
document.head.appendChild(script).parentNode.removeChild(script); | |
})(function () { | |
var size = 400; | |
var qr = new QRCode(document.body, { | |
text: location.href, | |
width: size, | |
height: size, | |
correctLevel : QRCode.CorrectLevel.L | |
}); | |
var img = qr._oDrawing._elImage; | |
var children = [].filter.call(document.body.childNodes, (el) => el != img); | |
children.forEach(document.body.removeChild.bind(document.body)); | |
var css = document.createElement('style'); | |
css.textContent = ` | |
:before, :after { | |
display: none; | |
} | |
img { | |
background: white; | |
border: ${4 * size / qr._oQRCode.moduleCount}px solid white; | |
bottom: 0; | |
box-shadow: none; | |
display: block; | |
height: auto; | |
left: 0; | |
margin: auto; | |
position: absolute; | |
right: 0; | |
text-align: center; | |
top: 0; | |
width: auto; | |
} | |
html, body { | |
margin: 0; | |
border: 0; | |
padding: 0; | |
height: 100%; | |
width: 100%; | |
} | |
body { | |
background: rgb(34, 34, 34) top left repeat url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAZGElEQVR4nHXdwXXjyBJEUTjAnbyhDzSH3sgIekNv+Bc9D30ZH73QkUQSharMyIjIhKbneL1et+fzeft8Prefn5/bz8/P7f1+3x6Px+1+v9+ez+ft9Xrd3u/37X6/335+fm7P5/N2v99vn8/n9vl8bvf7/XYcx+339/f8/n6/z7Ver9f5ma5/Pp+3x+Px9drPz8/5++fzuT2fz9vv7+/t9Xp9fbWP9t69Ho/Hubf23Ll+f3/P9V+v13nWPtc5e691H4/H7efn53a/32/v9/vrtfbyeDzO/b7f79vv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phbYBAespaqaYYFkxVmN55mvynCdjqJu5WxJX6FJoffGVz3BurPVtmjBtaqEtZV91utbN2rTKOwzHXss6U4gqocmQ41co5MWC4ovqizzbfBfyWkhRXHFUCpwPqTQVmWis80o0j5k2gZOM2HwfTxQsqMk+wf1srW3J7IBlla8pvf3GdHVPK331yhtRZ3/dwSbJId2O3gzIB6sTfV9BbwD67ZCsGJn9eiGtqFb0TURVteV/XW/ndNq2EHj2m/vp/OUMjdutg3qyGrg1zN139yMihTFSRSoE9LAmgUFVPpLgK+aLe3hUsbSn5VkF9yXNC3NaDrUve1h3FMAKnGbnPa1hkh9+nrfA9nOuxmpY4OjcFcFawxCuuXtdSJ+E94BFHsPYNVaPbqoDcRad0cZ9kBLkTlD19BErNas2Jv8nbd1n0OqsKRFrcjxsCbpynOrG25W7dEASEO6IQ8jTa75cMzR79r2rjeh0qj3l846s81nrwWy9hJVO4YRgGpYX8btcGNqxto+RTSk2a0WWF+TVgzKem/H59KBVtHmSQezblDa1C0tEETyvx6GCcZtAgWoFliDonGQSrtW+3xWiM2RIuhG7DFEi8K8PYdBsNoWGaJe6umeSz+uo9vasYTmQGvefg3OVvc2egJAoEWPjp8EjBqygCpeUWBJ+x8hJyZkdfkcFQAAAABJRU5ErkJggg=="); | |
} | |
`.replace(/;/g, ' !important;'); | |
document.head.appendChild(css); | |
document.body.addEventListener('click', function listener(e) { | |
document.body.removeEventListener('click', listener, false); | |
document.body.removeChild(img); | |
document.head.removeChild(css); | |
children.forEach(document.body.appendChild.bind(document.body)); | |
},false); | |
}); | |
/* | |
Copyright 2015 Thomas Rosenau | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like this goes over the maximum length of bookmarks in Chrome :(