From 1cd101fd9e4773f8c448cb597ee7fceeb2294de2 Mon Sep 17 00:00:00 2001 From: bitcoincoltd Date: Mon, 22 Jun 2015 15:55:30 +0700 Subject: [PATCH 1/2] QR codes for transaction data Added qr code popup buttons for transaction data textareas. This is useful for when transferring data to offline computers for signing via camera scan. --- index.html | 23 +++++++++++++++++++---- js/coinbin.js | 14 ++++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index c229fa4..8e1b664 100644 --- a/index.html +++ b/index.html @@ -538,7 +538,12 @@

The transaction below has been generated and encoded. It can be broadcasted once it has been signed.


- +
+ + + + +

Size: 0 bytes

@@ -740,8 +745,13 @@
- - + +
+ + + + +

@@ -753,7 +763,12 @@ diff --git a/js/coinbin.js b/js/coinbin.js index 885be2e..d326f41 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -929,8 +929,18 @@ $(document).ready(function() { $(".qrcodeBtn").click(function(){ $("#qrcode").html(""); var thisbtn = $(this).parent().parent(); - var qrcode = new QRCode("qrcode"); - qrcode.makeCode("bitcoin:"+$('.address',thisbtn).val()); + + if($('textarea',$(this).closest('.input-group')).length){ + var qrcode = new QRCode("qrcode",{width:512,height:512}); + var qrstr = $('textarea',$(this).closest('.input-group')).val(); + if(qrstr.length > 2000){ + $("#qrcode").html("

Sorry the data is too long for the QR generator.

"); + } + }else{ + var qrcode = new QRCode("qrcode"); + var qrstr = "bitcoin:"+$('.address',thisbtn).val(); + } + qrcode.makeCode(qrstr); }); $('input[title!=""], abbr[title!=""]').tooltip({'placement':'bottom'}); From d68361fba301b25fe6de7d1e9c6b154f31807507 Mon Sep 17 00:00:00 2001 From: bitcoincoltd Date: Mon, 22 Jun 2015 15:58:11 +0700 Subject: [PATCH 2/2] Minor adjustment to QR length handling Don't attempt to create QR code for huge data. --- js/coinbin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/coinbin.js b/js/coinbin.js index d326f41..05fadf4 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -935,6 +935,7 @@ $(document).ready(function() { var qrstr = $('textarea',$(this).closest('.input-group')).val(); if(qrstr.length > 2000){ $("#qrcode").html("

Sorry the data is too long for the QR generator.

"); + return; } }else{ var qrcode = new QRCode("qrcode");