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.
This commit is contained in:
bitcoincoltd 2015-06-22 15:55:30 +07:00
parent 8fed2612d5
commit 1cd101fd9e
2 changed files with 31 additions and 6 deletions

View file

@ -538,7 +538,12 @@
<label>Transaction</label> <label>Transaction</label>
<p>The transaction below has been generated and encoded. It can be broadcasted once it has been signed.</p> <p>The transaction below has been generated and encoded. It can be broadcasted once it has been signed.</p>
<br> <br>
<textarea class="form-control" style="height:150px" readonly></textarea> <div class="input-group">
<textarea class="form-control" style="height:150px" readonly></textarea>
<span class="input-group-btn">
<button class="qrcodeBtn btn btn-default" type="button" data-toggle="modal" data-target="#modalQrcode"><span class="glyphicon glyphicon-qrcode"></span></button>
</span>
</div>
<p class="text-muted">Size: <span class="txSize">0</span> <i>bytes</i></p> <p class="text-muted">Size: <span class="txSize">0</span> <i>bytes</i></p>
</div> </div>
@ -740,8 +745,13 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<label for="signTransaction">Transaction</label> <label for="signTransaction">Transaction</label>
<textarea type="text" id="signTransaction" class="form-control" style="height:125px"></textarea> <div class="input-group">
<textarea type="text" id="signTransaction" class="form-control" style="height:125px"></textarea>
<span class="input-group-btn">
<button class="qrcodeBtn btn btn-default" type="button" data-toggle="modal" data-target="#modalQrcode"><span class="glyphicon glyphicon-qrcode"></span></button>
</span>
</div>
</div> </div>
</div> </div>
<br> <br>
@ -753,7 +763,12 @@
<div class="alert alert-success hidden" id="signedData"> <div class="alert alert-success hidden" id="signedData">
<label>Signed transaction</label> <label>Signed transaction</label>
<p>The above transaction has been signed:</p> <p>The above transaction has been signed:</p>
<textarea class="form-control script" style="height:160px" readonly></textarea> <div class="input-group">
<textarea class="form-control script" style="height:160px" readonly></textarea>
<span class="input-group-btn">
<button class="qrcodeBtn btn btn-default" type="button" data-toggle="modal" data-target="#modalQrcode"><span class="glyphicon glyphicon-qrcode"></span></button>
</span>
</div>
<p class="text-muted">Size: <span class="txSize">0</span> <i>bytes</i></p> <p class="text-muted">Size: <span class="txSize">0</span> <i>bytes</i></p>
</div> </div>

View file

@ -929,8 +929,18 @@ $(document).ready(function() {
$(".qrcodeBtn").click(function(){ $(".qrcodeBtn").click(function(){
$("#qrcode").html(""); $("#qrcode").html("");
var thisbtn = $(this).parent().parent(); 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("<p>Sorry the data is too long for the QR generator.</p>");
}
}else{
var qrcode = new QRCode("qrcode");
var qrstr = "bitcoin:"+$('.address',thisbtn).val();
}
qrcode.makeCode(qrstr);
}); });
$('input[title!=""], abbr[title!=""]').tooltip({'placement':'bottom'}); $('input[title!=""], abbr[title!=""]').tooltip({'placement':'bottom'});