diff --git a/index.html b/index.html index 8e1b664..8db55cc 100644 --- a/index.html +++ b/index.html @@ -536,14 +536,12 @@ diff --git a/js/coinbin.js b/js/coinbin.js index 05fadf4..23ba6b8 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -929,19 +929,24 @@ $(document).ready(function() { $(".qrcodeBtn").click(function(){ $("#qrcode").html(""); var thisbtn = $(this).parent().parent(); - - if($('textarea',$(this).closest('.input-group')).length){ - var qrcode = new QRCode("qrcode",{width:512,height:512}); - var qrstr = $('textarea',$(this).closest('.input-group')).val(); + var qrstr = false; + var ta = $("textarea",thisbtn); + + if(ta.length>0){ + var w = (screen.availWidth > screen.availHeight ? screen.availWidth : screen.availHeight)/3; + var qrcode = new QRCode("qrcode", {width:w, height:w}); + qrstr = $(ta).val(); if(qrstr.length > 2000){ $("#qrcode").html("

Sorry the data is too long for the QR generator.

"); - return; } - }else{ + } else { var qrcode = new QRCode("qrcode"); - var qrstr = "bitcoin:"+$('.address',thisbtn).val(); + qrstr = "bitcoin:"+$('.address',thisbtn).val(); + } + + if(qrstr){ + qrcode.makeCode(qrstr); } - qrcode.makeCode(qrstr); }); $('input[title!=""], abbr[title!=""]').tooltip({'placement':'bottom'});