From ab4107bd5384de79c39e9e290babe377df1ecf2a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 24 Oct 2012 16:12:47 -0700 Subject: Hide QR when amount is blank --- css/bitcoin_pos.css | 1 + js/bitcoin_pos.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/css/bitcoin_pos.css b/css/bitcoin_pos.css index f6b80f58..4eb97575 100644 --- a/css/bitcoin_pos.css +++ b/css/bitcoin_pos.css @@ -6,6 +6,7 @@ span.btn { font-size: 1.4em; width: 80%; } small, label { color: #999; font-size: 1.2em; } strong#total { font-size: 2em; } img#banner { width: 100%; } +div#payment { display: none; } div.container-fluid { margin-left: auto; diff --git a/js/bitcoin_pos.js b/js/bitcoin_pos.js index f05407d3..396a371e 100644 --- a/js/bitcoin_pos.js +++ b/js/bitcoin_pos.js @@ -22,20 +22,22 @@ $(function() { $('#amount').keyup(updateTotal); $('#amount').focus(); $('#amount').focus(function() { - $('#payment').show(); $('#received').hide(); - $('#total').html('0'); $(this).val(''); + updateTotal(); }); function updateTotal() { var amount = parseFloat($('#amount').val()); var total = amount / exchange; total = Math.ceil(total * 10000) / 10000; - if (!$.isNumeric(total)) total = ''; - $('#total').html(total.toString()); - - displayQR('bitcoin:' + address + '?amount=' + total.toString()); + if (!$.isNumeric(total) || total == 0) { + $('#payment').fadeOut('slow'); + } else { + $('#payment').fadeIn('slow'); + $('#total').html(total.toString()); + displayQR('bitcoin:' + address + '?amount=' + total.toString()); + } } function setupSocket() { -- cgit v1.2.3