/ Published in: JavaScript
URL: http://pjotor.com/snipplr/qr/
This "plug in" (only a url builder really) returns the path to a QR code built by google chart api with the code of your choice and optional size (2:nd argument, 160px default).
Usage: $().qrcode("hello world") or $().qrcode("hello world",100)
Update! Added prototype version. Rebuilds image to a QRcode from the google charts API;
ex. document.getElementById("myImage").qrcode("hello world") makes the image with ID "myImage" to a QRcode with value "hello world"
Expand |
Embed | Plain Text
Bookmarklet: <a href='javascript:(function(s){var img = new Image();img.width=img.height=300;img.src="http://chart.apis.google"+".com/chart?cht=qr&chl="+encodeURIComponent(s)+"&chs=300x300";img.style.position="fixed";img.style.top=".5em";img.style.right=".5em";img.style.zIndex="1338";img.onclick=function(){this.style.display="none";};document.body.appendChild(img);})(document.location.href);'>QR-this</a> // jQuery plug in (function ($) { $.fn.qrcode = function(s,size) { size = size || 160; var api = "http://chart.apis.google.com/chart?cht=qr"; var url=api+"&chl="+encodeURIComponent(s); url+="&chs="+size+"x"+size; if(s) return url; } })(jQuery); // native Object prototype Object.prototype.qrcode = function(s,size){ size = size || 160; var src = "http://chart.apis.google.com/chart?cht=qr&chl="+ encodeURIComponent(s)+"&chs="+size+"x"+size; this.width = this.height = size; this.title = s; this.src = src; return this }
You need to login to post a comment.
