aboutsummaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/bitcoin_pos.js14
1 files changed, 8 insertions, 6 deletions
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() {