Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I read through the comments, expecting to see a JS version of this, but I didn't find one so I made it:

  javascript:(function(){ var i = new Image();i.src = 'http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl='+ encodeURIComponent(getSelection());i.onclick=function(){i.parentNode.removeChild(i)};i.setAttribute('style', 'position:fixed;top:50%;left:50%;margin:-150px 0 0 -150px;box-shadow:0 0 20px rgba(0,0,0,0.2)');document.body.appendChild(i)})();
Create a new bookmark, name it "QR Selection" and add the above code as the URL. Only tested in Chrome.

Edit: Added missing apostrophe.



Missing a closing apostrophe.

    javascript:(function(){var a=new Image;a.src="http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl="+encodeURIComponent(getSelection());a.onclick=function(){a.parentNode.removeChild(a)};a.setAttribute("style","position:fixed;top:50%;left:50%;margin:-150px 0 0 -150px;box-shadow:0 0 20px rgba(0,0,0,0.2)");document.body.appendChild(a)}());


That's pretty awsome, Better than mine: https://gist.github.com/findel/5099737


I've been using something roughly the same as this for a few months. Surprisingly handy, especially since you can use it to send URLs to just about any device.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: