From dc762c8715cfc6f75a6deac87fef89a09b954dfa Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 6 Feb 2016 18:13:27 -0800 Subject: Delay QR code generation, blur date select fields to prevent keyboard popup --- public/js/calculator.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'public/js/calculator.js') diff --git a/public/js/calculator.js b/public/js/calculator.js index d8eb7217..fe3ce42c 100644 --- a/public/js/calculator.js +++ b/public/js/calculator.js @@ -128,7 +128,7 @@ }; updateTotal = function() { - var precision, size, subtotal, total; + var precision, size, subtotal, time, total; precision = 9 - multiplier().toString().length; subtotal = parseFloat(g.amount * g.tip).toFixed(2); total = (subtotal * multiplier() / g.exchange).toFixed(precision); @@ -147,14 +147,21 @@ $('.commission').html("+" + (Math.abs(g.user.commission)) + "%"); } $('#total').html(total.toString()); - $('#qr').html(''); size = 300; $('#qr').css('height', size); - return new QRCode('qr', { - text: "bitcoin:" + g.user.address + "?amount=" + (g.amount_requested.toString()), - width: size, - height: size - }); + time = 0; + if (g.timeout) { + time = 1500; + } + clearTimeout(g.timeout); + return g.timeout = setTimeout(function() { + $('#qr').html(''); + return new QRCode('qr', { + text: "bitcoin:" + g.user.address + "?amount=" + (g.amount_requested.toString()), + width: size, + height: size + }); + }, time); }; listen = function() { -- cgit v1.2.3