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.coffee | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'public/js/calculator.coffee') diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index 69b24642..e6cc813e 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -142,16 +142,24 @@ updateTotal = -> $('#total').html(total.toString()) - $('#qr').html('') # size = $('#calculator').width() * 0.7 size = 300 $('#qr').css('height', size) - 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) + g.timeout = setTimeout(-> + $('#qr').html('') + new QRCode('qr', + text: "bitcoin:#{g.user.address}?amount=#{g.amount_requested.toString()}" + width: size + height: size + ) + , time) listen = -> g.attempts++ -- cgit v1.2.3